<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/projects.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:44 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>中骏森驰后台管理</title>
    <meta name="keywords" content="中骏森驰后台管理 - 课题管理">
    <meta name="description" content="中骏森驰后台管理 - 课题管理">

    <link href="<?=base_url('html/css/bootstrap.min14ed.css?v=3.3.6')?>" rel="stylesheet">
    <link href="<?=base_url('html/css/font-awesome.min93e3.css?v=4.4.0')?>" rel="stylesheet">
    <link href="<?=base_url('html/css/animate.min.css')?>" rel="stylesheet">
    <link href="<?=base_url('html/css/style.min862f.css?v=4.1.0')?>" rel="stylesheet">
    

</head>

<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox">
                    <div class="ibox-title">
                        <?php if($type == "title"):?>
                        <h5>课题类别管理</h5>
                        <div class="ibox-tools">
                            <a href="#" data-toggle="modal" class="btn btn-primary" data-target="#createModal">创建新类别</a>
                        </div>
                        <?php elseif($type == "content"):?>
                        <h5>课题管理</h5>
                        <div class="ibox-tools">
                            <a href="#" data-toggle="modal" class="btn btn-primary" data-target="#createProject">创建新课题</a>
                        </div>
                        <?php endif;?>
                    </div>
                    <div class="ibox-content">
                        <!--
                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-1">
                                <button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>
                            <div class="col-md-11">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入项目名称" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="button" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                        </div>
-->
                        <div class="project-list">

                            <table class="table table-hover">
                                <tbody>
                                    <?php if($type == "title"):?>
                                    <tr>
                                        <td class="project-status"><h3>序号</h3></td>
                                        <td class="project-title"><h3>课题类别</h3></td>
                                        <td class="project-completion"></td>
                                        <td class="project-people"></td>
                                        <td class="project-actions"><h3>操作</h3></td>
                                    </tr>
                                    <?php foreach ($data as $value):?>
                                    <tr>
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value["kid"]?>
                                        </td>
                                        
                                        <td class="project-title">
                                            <a href="#"><?=$value["PROJECTNAME"]?></a>
                                            <br/>
                                            <small>创建于 <?=$value["CREATETIME"]?></small>
                                        </td>
                                        <td class="project-completion">
                                                <!--
                                                <small>当前进度： 48%</small>
                                                <div class="progress progress-mini">
                                                    <div style="width: 48%;" class="progress-bar"></div>
                                                </div>
                                                -->
                                        </td>
                                        <td class="project-people">
                                        </td>
                                        <td class="project-actions">
                                            
                                            <a href="#" class="btn btn-white btn-sm" data-toggle="modal"data-target="#updateModal" onclick="proname('<?=$value['ID']?>','<?=$value['PROJECTNAME']?>')"><i class="fa fa-pencil"></i> 编辑 </a>
                                            <a href="#" class="btn btn-white btn-sm" onclick="del(<?=$value['ID']?>)"><i class="fa fa-folder"></i> 删除 </a>
                                        </td>
                                    </tr>
                                    <?php endforeach;?>
                                    <?php elseif($type == "content"):?>
                                    <tr>
                                        <td class="project-status"><h3>序号</h3></td>
                                        <td class="project-status"><h3>课题类别</h3></td>
                                        <td class="project-title"><h3>课题名称</h3></td>
                                        <td class="project-completion"><h3>预计收益(每月)</h3></td>
                                        <td class="project-people"><h3>进度</h3></td>
                                        <td class="project-actions"><h3>操作</h3></td>
                                    </tr>
                                    <?php foreach ($data as $value):?>
                                    <tr>
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value["kid"]?>
                                        </td>
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value["PROJECTNAME"]?>
                                        </td>
                                        <td class="project-title">
                                            <a href="#"><?=$value["TITLE"]?></a>
                                            <br/>
                                            <small><?=$value['CONTENT']?></small>
                                            <br/>
                                            <small>责任人 <?=$value['CREATER']?></small>
                                            <br/>
                                            <small>创建于 <?=$value["CREATETIME"]?></small>
                                        </td>
                                        <td class="project-completion">
                                                <?=$value['INCOME']?>
                                        </td>
                                        <td class="project-people">
                                            <small>当前进度： <?=$value['RATE']?>%</small>
                                            <div class="progress progress-mini">
                                                <div style="width: <?=$value['RATE']?>%;" class="progress-bar"></div>
                                            </div>
                                        </td>
                                        <td class="project-actions">
                                            
                                            <a href="#" class="btn btn-white btn-sm" data-toggle="modal"data-target="#editProject" onclick="updateprojectname('<?=$value['ID']?>','<?=$value['TITLE']?>','<?=$value['CONTENT']?>','<?=$value['INCOME']?>','<?=$value['PROJECTNAME']?>','<?=$value['RATE']?>','<?=$value['CREATER']?>')"><i class="fa fa-pencil"></i> 编辑 </a>
                                            <a href="#" class="btn btn-white btn-sm" onclick="delPro(<?=$value['ID']?>)"><i class="fa fa-folder"></i> 删除 </a>
                                        </td>
                                    </tr>
                                    <?php endforeach;?>
                                    <?php endif;?>
                                    </tbody>
                                </table>
                                <!-- 创建模态框（Modal） start-->
                                    <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                    <div class="modal-content">
                                                            <div class="modal-header">
                                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                                                    </button>
                                                                    <h4 class="modal-title" id="myModalLabel">
                                                                            创建课题类别
                                                                    </h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <label>课题类别名称</label>
                                                                    <input type="text" class="form-control" name="projectname_create">
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                                                            关闭
                                                                    </button>
                                                                    <button type="button" class="btn btn-primary" id="createsubmit">
                                                                            提交
                                                                    </button>
                                                            </div>
                                                    </div><!-- /.modal-content -->
                                            </div><!-- /.modal-dialog -->
                                    </div><!-- /.modal -->
                                    <!-- 创建模态框（Modal） end-->
                                    <!-- 修改模态框（Modal） start-->
                                    <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                    <div class="modal-content">
                                                            <div class="modal-header">
                                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                                                    </button>
                                                                    <h4 class="modal-title" id="myModalLabel">
                                                                            修改课题类别
                                                                    </h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <label>课题类别</label>
                                                                    <input type="text" class="form-control" name="projectname_update">
                                                                    <input type="hidden" name="updateID">
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                                                            关闭
                                                                    </button>
                                                                    <button type="button" class="btn btn-primary" id="updatesubmit">
                                                                            提交
                                                                    </button>
                                                            </div>
                                                    </div><!-- /.modal-content -->
                                            </div><!-- /.modal-dialog -->
                                    </div><!-- /.modal -->
                                    <!-- 模态框（Modal） end-->
                                    <!-- 创建课题模态框（Modal） start-->
                                    <div class="modal fade" id="createProject" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                    <div class="modal-content">
                                                            <div class="modal-header">
                                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                                                    </button>
                                                                    <h4 class="modal-title" id="myModalLabel">
                                                                            创建课题
                                                                    </h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <label>课题类别</label>
                                                                    <select class="form-control m-b" name="pid_create"id="pid_create">
                                                                        <?php foreach ($pdata as $pvalue):?>
                                                                        <option value="<?=$pvalue['ID']?>"><?=$pvalue['PROJECTNAME']?></option>
                                                                        <?php endforeach;?>
                                                                    </select>
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>课题名称</label>
                                                                    <input type="text" class="form-control" name="title_create">
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>课题内容</label>
                                                                    <textarea type="text" class="form-control" id="content_create"></textarea>
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>预计收益(W/每月)</label>
                                                                    <input type="text" class="form-control" name="income_create">
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>课题进度</label>
                                                                    <select class="form-control m-b" name="rate_create"id="rate_create">
                                                                        <option value="0">0%</option>
                                                                        <option value="10">10%</option>
                                                                        <option value="20">20%</option>
                                                                        <option value="30">30%</option>
                                                                        <option value="40">40%</option>
                                                                        <option value="50">50%</option>
                                                                        <option value="60">60%</option>
                                                                        <option value="70">70%</option>
                                                                        <option value="80">80%</option>
                                                                        <option value="90">90%</option>
                                                                        <option value="100">100%</option>
                                                                    </select>
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>责任人</label>
                                                                    <input type="text" class="form-control" name="creater_create">
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                                                            关闭
                                                                    </button>
                                                                    <button type="button" class="btn btn-primary" id="createproject_submit">
                                                                            提交
                                                                    </button>
                                                            </div>
                                                    </div><!-- /.modal-content -->
                                            </div><!-- /.modal-dialog -->
                                    </div><!-- /.modal -->
                                    <!-- 创建课题模态框（Modal） end-->
                                    <!-- 修改课题模态框（Modal） start-->
                                    <div class="modal fade" id="editProject" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                    <div class="modal-content">
                                                            <div class="modal-header">
                                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                                                    </button>
                                                                    <h4 class="modal-title" id="myModalLabel">
                                                                            修改课题
                                                                    </h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="form-group">
                                                                    <label>课题类别</label>
                                                                    <input type="text" class="form-control" name="pid_name" readonly="">
                                                                    <input type="hidden" name="edit_id">
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>课题名称</label>
                                                                    <input type="text" class="form-control" name="title_update">
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>课题内容</label>
                                                                    <textarea type="text" class="form-control" id="content_update"></textarea>
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>预计收益(W/每月)</label>
                                                                    <input type="text" class="form-control" name="income_update">
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>课题进度</label>
                                                                    <input type="text" class="form-control" name="rate_update" readonly>
                                                                </div>
                                                                <div class="form-group">
                                                                    <label>责任人</label>
                                                                    <input type="text" class="form-control" name="creater_update">
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                                                            关闭
                                                                    </button>
                                                                    <button type="button" class="btn btn-primary" id="editproject_submit">
                                                                            提交
                                                                    </button>
                                                            </div>
                                                    </div><!-- /.modal-content -->
                                            </div><!-- /.modal-dialog -->
                                    </div><!-- /.modal -->
                                    <!-- 修改课题模态框（Modal） end-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <script src="<?=base_url('html/js/jquery-1.8.3.min.js')?>"></script>
    <script src="<?=base_url('html/bootstrap_v3/js/bootstrap.min.js')?>"></script>
    <script src="<?=base_url('html/js/content.min.js')?>"></script>
    <script>
       $(document).ready(function() {
            $("#loading-example-btn").click(function() {
                btn = $(this);
                simpleLoad(btn, true);
                simpleLoad(btn, false)
            });
            $("#createsubmit").click(function(){
                var proname = $("input[name=projectname_create]").val();
                $.ajax({
                    type:"POST",
                    url:"<?=  base_url('ProjectManage/createProjectTitle')?>",
                    data:{
                        proname:proname
                    },
                    dataType:"json",
                    success:function(data){
                        location.reload();
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                    }
                })
            });
            $("#updatesubmit").click(function(){
                var proname = $("input[name=projectname_update]").val();
                var id = $("input[name=updateID]").val();
                $.ajax({
                    type:"POST",
                    url:"<?=  base_url('ProjectManage/updateProjectTitle')?>",
                    data:{
                        proname:proname,
                        id:id
                    },
                    dataType:"json",
                    success:function(data){
                        location.reload();
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                    }
                })
            });
        });
        function simpleLoad(btn, state) {
            if (state) {
                btn.children().addClass("fa-spin");
                btn.contents().last().replaceWith(" Loading")
            } else {
                setTimeout(function() {
                    btn.children().removeClass("fa-spin");
                    btn.contents().last().replaceWith(" Refresh")
                },
                2000)
            }
        }
        function proname(id,name){
            $("input[name=updateID]").val(id);
            $("input[name=projectname_update]").val(name);
        }
        function del(id){
            $.ajax({
                type:"POST",
                url:"<?=  base_url('ProjectManage/delProjectTitle')?>",
                data:{
                    id:id
                },
                dataType:"json",
                success:function(data){
                    location.reload();
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                }
            })
        }
        $("#createproject_submit").click(function(){
            var pid = $("#pid_create").val();
            var title = $("input[name=title_create]").val();
            var content = $("#content_create").val();
            var income = $("input[name=income_create]").val();
            var rate = $("#rate_create").val();
            var creater = $("input[name=creater_create]").val();
            $.ajax({
                type:"POST",
                url:"<?=  base_url('ProjectManage/createProject')?>",
                data:{
                    pid:pid,
                    title:title,
                    content:content,
                    income:income,
                    rate:rate,
                    creater:creater
                },
                dataType:"json",
                success:function(data){
                    location.reload();
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                }
            })
        })
        $("#editproject_submit").click(function(){
            var id = $("input[name=edit_id]").val();
            var title = $("input[name=title_update]").val();
            var content = $("#content_update").val();
            var income = $("input[name=income_update]").val();
            var creater = $("input[name=creater_update]").val();
            console.log("creater = " + creater);
            $.ajax({
                type:"POST",
                url:"<?=  base_url('ProjectManage/updateProject')?>",
                data:{
                    id:id,
                    title:title,
                    content:content,
                    income:income,
                    creater:creater
                },
                dataType:"json",
                success:function(data){
                    location.reload();
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                }
            })
        })
        function updateprojectname(id,title,content,income,projectname,rate,creater){
            $("input[name=edit_id]").val(id);
            $("input[name=title_update]").val(title);
            $("#content_update").val(content);
            $("input[name=income_update]").val(income);
            $("input[name=pid_name]").val(projectname);
            $("input[name=rate_update]").val(rate+"%");
            $("input[name=creater_update]").val(creater);
        }
        function delPro(id){
            $.ajax({
                type:"POST",
                url:"<?=  base_url('ProjectManage/delProject')?>",
                data:{
                    id:id
                },
                dataType:"json",
                success:function(data){
                    location.reload();
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                }
            })
        }
    </script>
    </body>

<!-- Mirrored from www.zi-han.net/theme/hplus/projects.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:44 GMT -->
</html>
